Home | Printable Version
5.2: DigitalOcean Droplet
One of the publication options enables you to publish to a WebMaker Server on a DigitalOcean Droplet. This can be very useful to help you publish your applications quickly. The WebMaker Studio has built in features to help you automate the publication process. Whether you are exporting static web pages or publishing transactional applications you can use the DigitalOcean Droplet to quickly and easily host your applications. The publication option provides direct integration with the droplet and if you are simply exporting static pages you can FTP them across. The DigitalOcean integration is supported from WebMaker Studio 10.5 Update 0001. Learn how to publish an application to a WebMaker Server on DigitalOcean Once you have a DigitalOcean account you can easily create an instance of the WebMaker Server App from the Marketplace. For detailed instructions please refer to the DigitalOcean Documentation. Once you have created your Droplet there are some configuration steps to follow below. You will need to logon to the droplet using SSH, which is explained in the following document, along with some additional information which you may find useful. Initial Server Setup with Ubuntu 20.04
Enabling SSL
We strongly recommend configuring your Droplet to use SSL connections. The easiest way to do this is to use the certbot tool to configure a free certificate provided by Let's Encrypt for example. Once your domain name is correctly mapped to your droplet you can enable this by running the following command from an SSH shell.
sudo certbot --apache
If you receive an error message stating The requested apache plugin does not appear to be installed then try using the following command to install the missing components before running the certbot call again.
sudo apt-get install python3-certbot-apache
For more detailed instructions on how to configure SSL, please see this guide produced by DigitalOcean.
Storing Your WebMaker License Key
In order to run applications published to the Droplet you will need to install a WebMaker Runtime Server license key. This could be a Java Gateway or Rules Server license depending on the applications you are trying to run. If you don't yet have a server license, please see the 'Optional Server Addons' section on the Hyfinity Website for details. Once you have your license key, you can SSH to the droplet and then edit the license file located at /usr/share/webmaker/license.hyf. You need to replace the contents of this file with your license key string. Alternatively, you could use an FTP client to connect to your droplet and replace the file itself with your existing license file.
Configuring Publish Settings in the WebMaker Studio
Once your project is ready for publication, you can use the Publish -> Publish Settings menu option to configure a new Publication Target, as discussed in the previous section. For publishing to a DigitalOcean droplet you can use the specific DigitalOcean Droplet Publication Target Type. This option will only require 4 parameters to be confirmed. The droplet.url will be the URL used to access your droplet. If you have configured a domain name you can use that (eg https://example.com) or alternatively you can use the IP address (eg http://<your IP Address>) When your droplet is first initialised it will generate a random username/password combination for you to use to publish and administer your applications. You can view these generated details by looking at the tomcat-users.xml file, eg
cat /etc/tomcat9/tomcat-users.xml
The wmpublish user should be entered into the Publication Target Settings in the studio, taking the appropriate password from this file. Finally, the context.path parameter indicates the path at which your application will be accessible. For example, if you use a value of 'myapp', then you would access your application using a URL like http://mydomain.com/myapp
Runtime Dashboard
The DigitalOcean Droplet includes an installation of the WebMaker Dashboard to enable you to easily view logs and configure settings for your published applications. This can be accessed on your droplet at the /wmdashboard path, eg https://mydomain.com/wmdashbaord/ and will require authenticating as the wmadmin user. The password to use for this user can be located in the file discussed previously. For details on how to use the Dashboard, please refer to the later section on Server Platform Administration
Redirecting Initial Requests
After publishing your application, it will be accessible via a URL of the form https://mydomain.com/myapp, which will show the 'start' page for your application. Often this will not be the page you want to show, and instead you will want to access a specific action; equivalent to using a URL like https://mydomain.com/myapp/startForm.do To set the action that should be called by default for a particular published application you can edit the web.xml configuration file for your project. As discussed elsewhere in the documentation, this file will be generated at test/publication time if not present, but you can place a copy in the WEB-INF directory within your project repository folder if you need to make adjustments. In this case it is the value of the welcome-file element that you would want to change, eg from 'start.do' to 'startForm.do' Alternatively, you can use Apache redirect configurations to handle redirecting initial requests to the correct location. Depending on whether or not you have enabled SSL via certbot, you will need to make these changes to either the /etc/apache2/sites-available/000-default.conf or /etc/apache2/sites-available/000-default-le-ssl.conf files. As an example, you could add a section like one of the following to redirect requests for the root of your domain (eg https://mydomain.com) to a specific application and/or action. (This is contained within a Proxy block as the ProxyPass directive is being used to pass requests through Apache to the Tomcat server.)
<Proxy *>
    RedirectMatch ^/$ /myapp/
</Proxy>
<Proxy *>
    RedirectMatch ^/$ /myapp/startForm.do
</Proxy>
Once changes have been made to the configuration, you will need to restart Apache for the new settings to be picked up:
sudo systemctl restart apache2
External Calls - JNDI Options Server Platform Administration